/***************************************************************************** 
** common/oem_func.c
** 
** Copyright (c) 2009~2014 ShangHai Infotm Ltd all rights reserved. 
** 
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
** 
** Description: OEM functions.
**
** Author:
**     Warits   <warits.wang@infotm.com>
**      
** Revision History: 
** ----------------- 
** 1.1  XXX 02/01/2010 XXX	Warits
*****************************************************************************/

#include <common.h>
#include <oem_func.h>
#include <oem_font.h>
#include <oem_graphic.h>
#include <oem_pic.h>
int oem_load_LK(void)
{
	return oem_load_img(CONFIG_SYS_PHY_LK_BASE, CONFIG_SYS_DISK_LK1_OFFS,
	   0, 0);
}
int oem_load_LK2(void)
{
	return oem_load_img(CONFIG_SYS_PHY_LK_BASE, CONFIG_SYS_DISK_LK2_OFFS,0, 0);
}

int oem_load_RD(void)
{
	return oem_load_img(CONFIG_SYS_PHY_RD_BASE, CONFIG_SYS_DISK_RD_OFFS, 0 , 0);

}
int oem_load_RD_(void)
{
	return oem_load_img(CONFIG_SYS_PHY_RD_BASE, CONFIG_SYS_DISK_RE_OFFS, 0 , 0);
}
#if 0 
int oem_load_KERNLOGO(void)
{
	/*
	 * It's better to get the first 16bytes of the file ,
	 * then we can get the acure size of the logo
	 */
	//FIXME
	uint32_t l;
	
	 oem_read_sys_disk((uint8_t *)CONFIG_SYS_PHY_KERNLG_BASE, CONFIG_SYS_DISK_KERNLG_OFFS, 4096);
	 if(oem_iskernlogo_legal((uint8_t *)CONFIG_SYS_PHY_KERNLG_BASE))
		 l = oem_getkernlogo_size((uint8_t *)CONFIG_SYS_PHY_KERNLG_BASE);
	 else{
		 printf("logo is damaged!!\n");
		 return 0;
	 }
	 return oem_read_sys_disk((uint8_t *)CONFIG_SYS_PHY_KERNLG_BASE, CONFIG_SYS_DISK_KERNLG_OFFS, l);
}
#endif 
/*
int oem_load_BOOTLOGO(void)
{
	uint32_t l;
	oem_read_sys_disk((uint8_t *)CONFIG_SYS_PHY_BOOTLG_BASE, CONFIG_SYS_DISK_BOOTLG_OFFS, 4096);
	if(oem_islogo_legal((uint8_t *)CONFIG_SYS_PHY_BOOTLG_BASE))
		l = oem_getlogo_size((uint8_t *)CONFIG_SYS_PHY_BOOTLG_BASE);
	else{
		printf("logo is damaged!!\n");
		return 0;
	}

	return oem_read_sys_disk((uint8_t *)CONFIG_SYS_PHY_BOOTLG_BASE, CONFIG_SYS_DISK_BOOTLG_OFFS, l);

}
*/
void oem_bootl(char *args)
{
	if(args)
	  setenv("bootargs", args);

	run_command("bootm 40007fc0", 0);

	/* If bootm not successful, system hangs here */
	printf("Bootm failed, system halted...\n");
	for(;;);
}

